<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04_DOM操作</title>
</head>
<body>
<button onclick="addMoney()">点我变富</button>
<hr>
<script>
    function addMoney(){//1.点击按钮时调用此函数
        let imgE=document.createElement('img'); //2.创建一个空的img元素<img>
        imgE.src='img/money.jpg'; //设置src属性
        imgE.width=200;
        let bodyE=document.querySelector('body');
        bodyE.append(imgE);

    }

</script>
</body>
</html>